﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GeckoPhotos.Service;
using GeckoPhotos.Models;

namespace GeckoPhotos.Auth
{
    public class AccountMembershipService : IMembershipService
    {
        private IMembershipProvider _provider;

        public AccountMembershipService()
            : this(null)
        {
        }

        public AccountMembershipService(IMembershipProvider provider)
        {
            _provider = provider ?? new GeckoMembershipProvider();
        }

        public int MinPasswordLength
        {
            get
            {
                return _provider.MinPasswordLength;
            }
        }

        public bool ValidateUser(string userName, string password)
        {
            return _provider.ValidateUser(userName, password);
        }

        public User RegisterNewUser(string userName, string password, string name, string email)
        {
            return _provider.RegisterNewUser(userName, password, name, email);
        }

        public bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            return _provider.ChangePassword(userName, oldPassword, newPassword);
        }
    }
}
